package demo.myEnum;

import com.alibaba.fastjson.JSONArray;
import demo.using.MyJSONArray;
import demo.using.MyJSONObject;
import demo.utils.StringUtil;
import org.apache.commons.lang3.RandomStringUtils;

/**
 * @author : GuoFei
 * @date : 2018/12/14 18:22
 */
public class TestEnum {

    public static void change() {
        Signal color = Signal.RED;
        switch (color) {
            case RED:
                color = Signal.GREEN;
                break;
            case YELLOW:
                color = Signal.RED;
                break;
            case GREEN:
                color = Signal.YELLOW;
                break;
        }
        System.out.println(color);
    }

    @SuppressWarnings("all")
    public static void main(String[] args) {
//        id , name , path , videoId , videoName
        JSONArray ja = new MyJSONArray().append(
                new MyJSONObject<>()
                        .put("id", 1)
                        .put("videoName", StringUtil.randomStr(3))
                        .put("test", 2)

        ).append(
                new MyJSONObject<>()
                        .put("id", 2)
                        .put("videoId", 1)
                        .put("videoName", StringUtil.randomStr(3))
        ).append(
                new MyJSONObject<>()
                        .put("id", 3)
                        .put("videoId", 2)
                        .put("videoName", StringUtil.randomStr(3))
                        .put("test", 2)
        ).append(
                new MyJSONObject<>()
                        .put("id", 4)
                        .put("videoId", 2)
                        .put("videoName", StringUtil.randomStr(3))
                        .put("test", 2)
        ).append(
                new MyJSONObject<>()
                        .put("id", 5)
                        .put("videoId", 1)
                        .put("videoName", StringUtil.randomStr(3))
        ).append(
                new MyJSONObject<>()
                        .put("id", 6)
                        .put("videoId", 2)
                        .put("videoName", StringUtil.randomStr(3))
        );
        System.out.println(ja);

    }
}
